import config from '../../au.config.js';
let zLoad=require('./z.js');
try{
    let fetch=window.fetch;
    window.fetch=function(url,obj){
        if(url.includes('.hot-update.json') && !url.includes('http')){
            url=config.serviceHost+'/'+url;
        }
        return fetch.call(this,url,obj);
    }
}catch (e) {

}
try {
    let headAppend=document.head.appendChild;
    document.head.appendChild=function(el){
        if(el.src && el.src.includes(config.serviceHost) && el.src.substr(el.src.length-2)=='js'){
            return zLoad.loadJs(el.src).then(()=>{
                el.onload && el.onload();
            });
        }
        return headAppend.apply(this,arguments);
    };
}catch (e) {

}
